<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="icon" href="/i/ins.ico" type="image/x-icon"/>
    <title>爬虫工具</title>
</head>
<body>
    <div>
        <form action="../request/", target="result">
            请求url:<br>
           <input type="text" name="url">
            <br>
           <!-- 单选 -->
           <input type="radio" name="style" value="login" checked>登录
            <input type="radio" name="style" value="nologin">非登录
           <br><br>
           <input type="submit" value="Submit">
        </form> 
    </div>
    <iframe name="result" id="external-frame"  width="100%" scrolling="no">
    </iframe>
    <script>
        function setIframeHeight(iframe) {
            if (iframe) {
                var iframeWin = iframe.contentWindow || iframe.contentDocument.parentWindow;
                if (iframeWin.document.body){
                    iframe.height = iframeWin.document.documentElement.scrollHeight || iframeWin.document.body.scrollHeight;
                };
                iframe.onload = "setIframeHeight(this)";
                }
        };
        function reinitIframe(){
        var iframe = document.getElementById("external-frame");
        try{
        var bHeight = iframe.contentWindow.document.body.scrollHeight;
        var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
        var height = Math.max(bHeight, dHeight);
        iframe.height = height;
        console.log(height);
        }catch (ex){}
        }
        window.setInterval("reinitIframe()", 200);
        window.onload = function () {
            setIframeHeight(document.getElementById('external-frame'));
        };
    </script>
        
</body>
</html>